<?php

abstract class ComponentBase extends AbstractLoader {

    /**
     *
     * @param string $name
     * @return BaseService
     */
    protected function resolveObject($name) {
        $serviceName = $name . "Service";
        $this->checkFile($serviceName, Loader::toSinglePath("Models::Services", DS));

        /* @var $service RESTfulClient */
        $service = new $serviceName($name, ModulesContext::instance()->getConfig()->get("ServicesURI"));

        $user = ModulesContext::instance()->getCurrentUser();

        $service->addHeaderVariable("username", $user->getName());
        $service->addHeaderVariable("password", md5($user->getCredential()));

        return $service;
    }

}

?>